package com.example.musicproject_b.Controller;

import com.example.common.b_pojo.Musicimg;
import com.example.dao.mapper.BAdminMapper;
import com.example.dao.mapper.BMusicimgMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

@RestController
@RequestMapping("/B_test")
public class B_HelloController {

    @Autowired
    public BMusicimgMapper bMusicimgMapper;

    @Autowired
    public BAdminMapper bAdminMapper;

    @RequestMapping("/hello")
    @PreAuthorize("hasRole('ROLE_USER')")
    public String hello(){
        return "Hello Bank!";
    }

    @RequestMapping("/hello1")
    @PreAuthorize("hasRole('ROLE_USER') and hasAuthority('PERMISSION_权限1')")
    public String hello1(){
        return "Hello roles";
    }

    @RequestMapping("/hello2")
    @PreAuthorize("hasAuthority('PERMISSION_权限1')")
    public String hello2(){
        return "Hello PERMISSION_权限1";
    }

    @RequestMapping("/test")
    public String test(){
        return "test11111111111111111111111111111";
    }

}
